package ocrs.server.registeringSystem;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class StringPlusCharacter 
{
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key theKey;
	
    @Persistent
    private String theString;
    
    @Persistent
    private char theChar;
    
    
    public StringPlusCharacter()
    {
    	theString = "";
    	theChar = ' ';
    }
    
    
    public StringPlusCharacter(String theString, char theChar)
    {
    	// this will help will searching the array (null pointer exceptions)
    	if(theString != null)
    	    this.theString = theString;
    	
    	else
    		this.theString = "";
    	
    	this.theChar = theChar;
    }
    
    
    public StringPlusCharacter(StringPlusCharacter copyThisObject)
    {
    	if(copyThisObject != null)
    	{
    		theString = new String(copyThisObject.theString);
    		theChar = copyThisObject.theChar;
    	}
    	
    	else
    	{
    		theString = "";
    		theChar = ' ';
    	}
    }
    
    
    
    /** 
     * Name: getTheKey <br><br>
     * An accessor method that retrieves the the key for the object in the
     * Google datastore.
     * <br><br>
     * Precondition: None <br>
     * Postcondition: Returns the key. <br>
     * @param None
     */
    public Key getTheKey()
    {
    	return theKey;
    } // end of getTheKey()
    
    
    public String getTheString()
    {
        return theString;
    } // end of getTheString()
    
    
    public char getTheChar()
    {
        return theChar;
    } // end of getTheChar()
    
    
    public void setTheString(String newString)
    {
        theString = newString;	
    } // end of setTheString()
    
    
    public void setTheChar(char newChar)
    {
    	theChar = newChar;
    } // end of setTheChar()
} // end of StringPlusCharacter class